<!--
 * @Author: 蔡继周
 * @Date: 2021-11-16 10:55:00
 * @LastEditTime : 2021-11-26 23:52:44
 * @LastEditors  : huzhenhong
 * @Description: el-cascader
-->
<template>
  <el-form-item
    rm-item
    :label="column.title ? column.title + '：' : ''"
    :prop="column.name"
    :rules="rules"
  >
    <el-cascader
      v-model="value"
      :options="column.options"
      :placeholder="`请选择${column.title}`"
      @change="(value) => column.change && column.change(value)"
      v-bind="column.definProps"
      style="width: 100%"
    />
  </el-form-item>
</template>
<script setup>
import { computed } from "vue";
import useComputedRule from "./../hooks/useComputedRule";
const emit = defineEmits(["update:model"]);
const props = defineProps({
  column: {
    type: Object,
    default: () => {},
  },
  model: {
    type: Array,
    default: () => [],
  },
});
const { rules } = useComputedRule(props);
const value = computed({
  get: () => props.model,
  set: (val) => {
    emit("update:model", val);
  },
});
</script>
